package com.le.tester.leetcode;

import com.le.tester.leetcode.common.TreeNode;

/**
 * createTime：2021/8/13 14:47
 * description：树得最大深度
 */
public class MaxDepth {
    public int maxDepth(TreeNode root) {
        if (root == null) {
            return 0;
        } else {
            int left = maxDepth(root.left);
            int right = maxDepth(root.right);
            return Math.max(left, right) + 1;
        }
    }
}
